package edu.pku.sei.gefcommon.descriptor.descriptors;

import org.eclipse.jface.viewers.LabelProvider;

public class EnumerationLabelProvider extends LabelProvider {
	private EnumerationPropertyDescriptor host;
	public EnumerationLabelProvider(EnumerationPropertyDescriptor descriptor) {
		super();
		host = descriptor;
	}
	public String getText(Object element) {
		if(element instanceof Integer||element.getClass()==int.class){
			Integer index = (Integer)element;
			if(index>=0&&index<host.getStrings().length)
				return host.getStrings()[(Integer)element];
			return "";
		}
		return element.toString();
	}
}
